<?php
$yii2appid = \common\config\Env::$yii2appid_admin;
return [
    'id' => $yii2appid,
    'basePath' => dirname(__DIR__),
    'name' => "TITLE-ADMIN",
    'homeUrl' => '/admin',
    'controllerNamespace' => 'admin\controllers',
    'bootstrap' => ['logreader'],
    'components' => [
        'request' => [
            'csrfParam' => YII_ENV . "_" . 'csrf-home-admin',
        ],
        'session' => [
            'name' => YII_ENV . "_" . 'session-home-admin',
            'useCookies' => true,
            'timeout' => 3600 * 24 * 30,
            'cookieParams' => [
//                'domain' => YII_ENV."_".$_SERVER['HTTP_HOST'],
//                'path' => '/',
                'httpOnly' => true,
                'lifetime' => 3600 * 24 * 30,
            ],
        ],
        'user' => [
            'class' => \common\rewrite\web\User::class,
            'identityClass' => \common\models\db\User::class,
            'loginUrl' => \common\config\Env::getUrls()['home_url'] . "/site/login" . \common\config\Env::$home_suffix,
            'enableAutoLogin' => true,
            'autoRenewCookie' => true,
            'enableSession' => true,
            'identityCookie' => [
                'name' => YII_ENV . "_" . 'identity-home-admin',
                'domain' => YII_ENV . "_" . $_SERVER['HTTP_HOST'],
                'httpOnly' => true,
            ],
        ],
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => YII_ENV == 'dev' ? true : false,
            'rules' => [],
        ],
        'assetManager' => [
            // 线上建议将forceCopy设置成false，如果访问量不大无所谓
            'forceCopy' => YII_ENV == 'dev' ? true : false,
            'linkAssets' => YII_ENV == 'dev' ? true : false,
            /*'assetMap' => [
                'AdminLTE.css' => '@wurl/css/AdminLTE.css',
            ],*/
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'appinfo' => [
            'class' => \common\members\wodrow\components\yii2app\Appinfo::class,
            'name' => $yii2appid,
        ],
    ],
    'controllerMap' => [
        'ueditor' => [
            'class' => \common\members\wodrow\widgets\ueditor\UEditorController::class,
            'thumbnail' => false,//如果将'thumbnail'设置为空，将不生成缩略图。
//            'thumbnail' => ['height' => 200, 'width' => 200],
//            'watermark' => [    //默认不生存水印
//                'path' => '', //水印图片路径
//                'position' => 9 //position in [1, 9]，表示从左上到右下的 9 个位置，即如1表示左上，5表示中间，9表示右下。
//            ],
//            'zoom' => ['height' => 500, 'width' => 500], //缩放，默认不缩放
            'config' => [
                //server config @see http://fex-team.github.io/ueditor/#server-config
                'imageUrlPrefix' => "",
                'imagePathFormat' => '/uploads/ueditor/image/{yyyy}-{mm}-{dd}/{time}_{rand:6}',
                'scrawlPathFormat' => '/uploads/ueditor/image/{yyyy}-{mm}-{dd}/{time}_{rand:6}',
                'snapscreenPathFormat' => '/uploads/ueditor/image/{yyyy}-{mm}-{dd}/{time}_{rand:6}',
                'catcherPathFormat' => '/uploads/ueditor/image/{yyyy}-{mm}-{dd}/{time}_{rand:6}',
                'videoPathFormat' => '/uploads/ueditor/video/{yyyy}-{mm}-{dd}/{time}_{rand:6}',
                'filePathFormat' => '/uploads/ueditor/file/{yyyy}-{mm}-{dd}/{time}_{rand:4}_{filename}',
                'imageManagerListPath' => '/uploads/ueditor/image/',
                'fileManagerListPath' => '/uploads/ueditor/file/',
            ],
            'allowIntranet' => true, // 允许内网，默认false
        ]
    ],
    'modules' => [
        'gridview' => [
            'class' => \kartik\grid\Module::class,
        ],
        'datecontrol' => [
            'class' => \kartik\datecontrol\Module::class,
            // see settings on http://demos.krajee.com/datecontrol#module
        ],
        'redactor' => [
            'class' => \yii\redactor\RedactorModule::class,
        ],
        // If you use tree table
        'treemanager' => [
            'class' => \kartik\tree\Module::class,
            /*'treeViewSettings' => [
                'nodeView' => '@common/rewrite/kartikv/treemanager/src/views/_form',
                'nodeAddlViews' => [
//                    \kartik\tree\Module::VIEW_PART_1 => \kartik\tree\Module::VIEW_PART_1,
                    \kartik\tree\Module::VIEW_PART_2 => '@common/rewrite/kartikv/treemanager/src/views/_2',
//                    \kartik\tree\Module::VIEW_PART_3 => \kartik\tree\Module::VIEW_PART_3,
//                    \kartik\tree\Module::VIEW_PART_4 => \kartik\tree\Module::VIEW_PART_4,
//                    \kartik\tree\Module::VIEW_PART_5 => \kartik\tree\Module::VIEW_PART_5,
                ],
            ],*/
            // see settings on http://demos.krajee.com/tree-manager#module
        ],
        'logreader' => [
            'class' => \zhuravljov\yii\logreader\Module::class,
            'aliases' => [
                'Home Errors' => '@home/runtime/logs/app.log',
                'Admin Errors' => '@admin/runtime/logs/app.log',
                'Api Errors' => '@appapi/runtime/logs/app.log',
                'Console Errors' => '@console/runtime/logs/app.log',
            ],
        ],
        'basedata' => \admin\modules\basedata\Basedata::class, // 基础信息
        'user' => \admin\modules\user\User::class, // 客户管理
        'rbac' => \admin\modules\rbac\Rbac::class,
        'logs' => \admin\modules\logs\Logs::class,
        'equipment_info' => \admin\modules\equipment_info\EquipmentInfo::class,
        'docu' => \admin\modules\docu\Docu::class,
        'test' => \admin\modules\test\Test::class,
    ],
    'as login' => [
        'class' => \yii\filters\AccessControl::class,
        'rules' => [
            [
                'allow' => true,
                'roles' => ['@'],
            ],
        ],
    ],
    'as rbac' => [
        'class' => \admin\behaviars\Rbac::class,
        'except' => [
            'site/*',
        ],
        'rules' => [
            [
                'allow' => true,
                'roles' => ['@'],
            ],
        ],
    ],
    'params' => [],
];
